//
//  LGFollowUpRecommedCell.m
//  HeartDiseaseManage
//
//  Created by 1234 on 2023/5/26.
//  随访建议

#import "LGFollowUpRecommedCell2.h"

@interface LGFollowUpRecommedCell2()
/**   */
@property (nonatomic , strong)UILabel *contentLabel;
/**   */
@property (nonatomic , strong)UIView *baseView;
/**   */
@property (nonatomic , strong)UILabel *titleLabel;
/**   */
@property (nonatomic , strong)UIView *lineView;
/**   */
@property (nonatomic , strong)UIButton *medicTitle;
/**   */
@property (nonatomic , strong)UILabel *medicContent;
/**   */
@property (nonatomic , strong)UIButton *followTitle;
/**   */
@property (nonatomic , strong)UILabel *followContent;
/**   */
@property (nonatomic , strong)LGCustomCellData *cellData;

@end

@implementation LGFollowUpRecommedCell2

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubView];
    }
    return  self;
}

-(void)setDataDic:(NSDictionary *)dataDic{
    [super setDataDic:dataDic];
    self.bubbleView.image = self.receiverBubble;
    NSDictionary *contentDic = [ObjectTool jsonToObject:dataDic[@"content"][@"ext"]];
    NSDictionary *tempDic = contentDic[@"msgcontent_doctor"];
    self.titleLabel.text = LGNSString(tempDic[@"title"]);
    self.medicContent.text = LGNSString(tempDic[@"drug_plan"]);
    self.followContent.text = LGNSString(tempDic[@"followup_content"]);
    [self.bubbleView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.width.equalTo(@(Screen_W-viewPix(100)));
    }];
}


-(void)createSubView{
    [self.bubbleView addSubview:self.baseView];
    [self.baseView addSubview:self.titleLabel];
    [self.baseView addSubview:self.lineView];
    [self.baseView addSubview:self.medicTitle];
    [self.baseView addSubview:self.medicContent];
    [self.baseView addSubview:self.followTitle];
    [self.baseView addSubview:self.followContent];
    [self.baseView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.bottom.equalTo(self.bubbleView);
        make.width.equalTo(@(Screen_W-viewPix(100)));
    }];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.baseView).offset(viewPix(10));
        make.left.equalTo(self.baseView).offset(viewPix(12));
        make.right.equalTo(self.baseView).offset(-viewPix(12));
    }];
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.titleLabel.mas_bottom).offset(viewPix(10));
        make.left.right.equalTo(self.titleLabel);
        make.height.equalTo(@(0.5));
    }];
    [self.medicTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.lineView.mas_bottom).offset(viewPix(9));
        make.left.right.equalTo(self.titleLabel);
        make.height.equalTo(@(20));
    }];
    [self.medicContent mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.medicTitle.mas_bottom).offset(viewPix(6));
        make.left.right.equalTo(self.titleLabel);
    }];
    [self.followTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.medicContent.mas_bottom).offset(viewPix(9));
        make.left.right.equalTo(self.titleLabel);
        make.height.equalTo(@(20));
    }];
    [self.followContent mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.followTitle.mas_bottom).offset(viewPix(6));
        make.left.right.equalTo(self.titleLabel);
    }];
}

-(UIView *)baseView{
    if(!_baseView){
        _baseView = [[UIView alloc] init];
        _baseView.backgroundColor = [UIColor whiteColor];
        _baseView.cornerRidus = 15;
    }
    return _baseView;
}

-(UILabel *)titleLabel{
    if(!_titleLabel){
        _titleLabel = [UILabel lableWithText:@"您发送了随访建议" colorString:@"#333333" textFont:LGFontWeight(14, UIFontWeightMedium) textAlignment:NSTextAlignmentLeft lines:1];
    }
    return _titleLabel;
}


-(UIView *)lineView{
    if(!_lineView){
        _lineView = [[UIView alloc] init];
        _lineView.backgroundColor = [UIColor colorWithString:@"#E0E0E0"];
    }
    return _lineView;
}

-(UIButton *)medicTitle{
    if(!_medicTitle){
        _medicTitle = [UIButton buttonWithTitle:@"药物调整方案" titleFont:LGFont(14) textColor:@"#666666" imageName:@"随访建议-药物调整"];
        _medicTitle.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
        _medicTitle.titleEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 0);
    }
    return _medicTitle;
}

-(UILabel *)medicContent{
    if(!_medicContent){
        _medicContent = [UILabel lableWithText:@"" colorString:@"#333333" textFont:LGFont(12) textAlignment:NSTextAlignmentLeft lines:0];
    }
    return _medicContent;
}

-(UIButton *)followTitle{
    if(!_followTitle){
        _followTitle = [UIButton buttonWithTitle:@"随访建议" titleFont:LGFont(14) textColor:@"#666666" imageName:@"随访建议-随访建议"];
        _followTitle.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
        _followTitle.titleEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 0);
    }
    return _followTitle;
}

-(UILabel *)followContent{
    if(!_followContent){
        _followContent = [UILabel lableWithText:@"" colorString:@"#333333" textFont:LGFont(12) textAlignment:NSTextAlignmentLeft lines:0];
    }
    return _followContent;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
